package n14.first;
public class Person {
	private String name; //姓名
	private int age; //年龄
	public Person(String name,int age) {
		this.name=name;
		this.age=age;
	}
	public String getName() {
		return name;
	}
	public int getAge() {
		return age;
	}
	@Override
	public String toString() {
		return name+"•"+age+"岁";
	}
	@Override
	public boolean equals(Object obj) { //重写Object的equals方法
		Person p=(Person)obj;
		return name.equals(p.name) && age==p.age;
	}
	@Override
	public int hashCode() { //重写Object的hashCode方法
		return (name+age).hashCode();
	}
}